package com.lc.afbx.activity;

import android.os.Bundle;
import android.view.View;
import android.widget.ListView;
import android.widget.TextView;

import com.lc.afbx.R;
import com.lc.afbx.adapters.TeamBaoDanAdapter;
import com.lc.afbx.conn.GetApiTeamMemberBaoDan;
import com.zcx.helper.http.AsyCallBack;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2016/6/8.
 */
public class TeamPolicyActivity extends BaseActivity implements View.OnClickListener {

    private TextView team_policy_name_tv;
    private TextView team_policy_count_tv;

    private ListView team_policy_lv;
    private TeamBaoDanAdapter adapter;
    private List<GetApiTeamMemberBaoDan.Data> lists = new ArrayList<>();

    private GetApiTeamMemberBaoDan getApiTeamMemberBaoDan = new GetApiTeamMemberBaoDan(new AsyCallBack<GetApiTeamMemberBaoDan.Info>() {
        @Override
        public void onSuccess(String toast, int type, GetApiTeamMemberBaoDan.Info info) throws Exception {

            team_policy_name_tv.setText("姓名：" + info.username);
            team_policy_count_tv.setText("全部" + info.num + "个保单");

            lists.addAll(info.dataList);
            adapter.notifyDataSetChanged();

        }

    });

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_team_policy);

        team_policy_name_tv = ((TextView) findViewById(R.id.team_policy_name_tv));
        team_policy_count_tv = ((TextView) findViewById(R.id.team_policy_count_tv));
        team_policy_lv = ((ListView) findViewById(R.id.team_policy_lv));
        team_policy_lv.setDivider(null);

        team_policy_lv.setAdapter(adapter = new TeamBaoDanAdapter(context, lists));

        getApiTeamMemberBaoDan.userid = getIntent().getStringExtra("tid");
        getApiTeamMemberBaoDan.execute(context);
    }


    @Override
    public void onClick(View view) {

        switch (view.getId()) {

            case R.id.back:
                finish();
                return;


        }


    }


}
